package jgame;

import java.awt.Rectangle;

import javax.swing.JTextArea;
import javax.swing.text.BadLocationException;

public class LogField extends JTextArea {
	public void appendText(String text)
	{
		try {
			this.getDocument().insertString(this.getDocument().getLength(), text+"\n", null);
		} catch (BadLocationException e) {
			System.out.println(e.getMessage());
		}
		
		//scroll to bottom
		this.setCaretPosition( this.getText().length() );
		this.setSize(this.getWidth(), this.getHeight()+10);
	}
}
